<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<% String path = request.getContextPath(); %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>HR医院 - 职称列表</title>
	<meta name="keywords" content="">
	<meta name="description" content="">

	<link rel="shortcut icon" href="favicon.ico">
	<link href="<%=path %>/statics/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link href="<%=path %>/statics/css/font-awesome.css?v=4.4.0" rel="stylesheet">

	<!-- Data Tables -->
	<link href="<%=path %>/statics/css/plugins/dataTables/dataTables.bootstrap.css"
		rel="stylesheet">
	<link href="<%=path %>/statics/css/animate.css" rel="stylesheet">
	<link href="<%=path %>/statics/css/style.css?v=4.1.0" rel="stylesheet">

</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
		<div class="col-md-3" style="padding:2em 0;">
			<button type="button" class="btn btn-success btn-block" id="generate-excel"><i class="fa fa-file-excel-o" aria-hidden="true"></i> 将表格转换为Excel</button>
		</div>
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>职称列表</h5>
					</div>
					<div class="ibox-content">
						<div>
							<a href="<%=path %>/position/toAdd" class="btn btn-success">添加职称</a>
						</div>
						<table class="table table-striped table-bordered table-hover dataTables-example" id="test_table">
							<thead>
								<tr>
									<th>序号</th>
									<th>职称号</th>
									<th>职称名称</th>
									<th>权限</th>
									<th width="240px">描述</th>
									<th>管理</th>
								</tr>
							</thead>
							<tbody>
							<c:forEach var="position" items="${list}">
								<tr class="gradeA">
									<td>${position.id}</td>
									<td>${position.positionNumber}</td>
									<td>${position.name}</td>
									<td>${position.level}</td>
									<td>${position.notes}</td>
									<td><a href="<%=path %>/position/toUpdate?id=${position.id}" class="btn btn-primary">修改</a>&nbsp;&nbsp;
										<a href="javascript:" name="${position.id}" class="aa btn btn-danger">删除</a></td>
								</tr>
							</c:forEach>
							</tbody>
						</table>
						<div>
							<span style="float: left; padding: 5px">
								当前&nbsp;<span style="color: red;">${currentPageNo}</span>&nbsp;/&nbsp;<b>${totalPageCount}</b>&nbsp;页&nbsp;&nbsp;
								总共&nbsp;<b>${totalCount}</b>&nbsp;条</span>
							<nav aria-label="Page navigation" style="margin: 0 auto; width: 240px">
								<ul class="pagination" style="margin: 0;">
									<li>
										<a href="<%=path %>/position/listPage1?currentPageNo=${currentPageNo-1}"
											aria-label="Previous"> <span aria-hidden="true">前一页</span>
										</a>
									</li>
						
									<li><a href="<%=path %>/position/listPage2?currentPageNo=${currentPageNo+1}"
										aria-label="Next"> <span aria-hidden="true">后一页</span>
									</a></li>
								</ul>
							</nav>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<!-- 全局js -->
	<script src="<%=path %>/statics/js/jquery.min.js?v=2.1.4"></script>
	<script src="<%=path %>/statics/js/bootstrap.min.js?v=3.3.6"></script>
	<script src="<%=path %>/statics/js/plugins/jeditable/jquery.jeditable.js"></script>
	<!-- 报表导出 -->
	<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
	<script type="text/javascript" src="https://cdn.bootcss.com/jszip/3.1.5/jszip.min.js"></script>
	<script type="text/javascript" src="<%=path %>/statics/js/external/FileSaver.js"></script>
	<script type="text/javascript" src="<%=path %>/statics/js/scripts/excel-gen.js"></script>
	<script type="text/javascript" src="<%=path %>/statics/js/scripts/demo.page.js"></script>
	<!-- Data Tables -->
	<script src="<%=path %>/statics/js/plugins/dataTables/jquery.dataTables.js"></script>
	<script src="<%=path %>/statics/js/plugins/dataTables/dataTables.bootstrap.js"></script>

	<!-- 自定义js -->
	<script src="<%=path %>/statics/js/content.js?v=1.0.0"></script>
	<script>
	$(function(){
		$(".aa").click(function(){
			var obj = event.target || event.srcElement; 					
			var id=$(obj).attr("name");
			var t = $(this).parent().parent();
			console.log(id);
			$.ajax({
				type:"get",
				url:"<%=path %>/position/delete",
				data:"pid="+id,
				dataType:"json",
				success:function(data){
					console.log(data);
					if(data.count==1){
						t.remove();
					}
				}
			});
		});
	});
	</script>
</body>
</html>